﻿@model ThaireInvestmentWeb.Models.FixedIncomeGuaranteeModel
@{
    ViewBag.Title = "INPUT Guarantee Fixed Income Securities";
}
<script>
    $(document).ready(function () {

        $("#StartDate,#EndDate").datepicker(
            {
                dateFormat: 'dd/mm/yy',
                showOn: 'button',
                showAnim: 'fadeIn',
                changeMonth: true,
                changeYear: true,
                showButtonPanel: true,
                buttonImage: '@Url.Content("~/Content/images/Calendar.png")',
            });
      
      
        $("#BtnCancel").click(function (event) {

            //  showConfirm(null, testYes);
            showConfirm("ยกเลิก ?", function ()
            {
                //มาจากหน้าเพิ่ม
                @if (Request["transactionID"]==null)
                {
                     <text>
                window.location.href = 'EditPurchase?purchaseID=@Model.PurcheseID';
                     </text> 
                }else
                {
                     <text>
                window.location.href = 'EditFixedIncome?fixedincomeID=@Model.HeaderID';
                     </text> 
                }
            });
              return false;
          });

    });
</script>


<table class="navi" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td style="width: 100%;">
            <div class="navi">Instrument Type > <a href="fixedIncomeList">Fixed Income List</a>> <a href="ManageFixedIncomeSecurittes">Header </a>> <a href="AddFixedIncomePurchase">Purchase </a>> Guarantee </div>
        </td>
    </tr>
</table>

<table class="tableheader" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td height="38" align="center" style="width: 100%; text-align: center;">INPUT Guarantee Fixed Income Securities</td>
    </tr>
</table>

<table width="951" border="0" align="center">
    <tr>
        <td>@Html.ValidationSummary(true)</td>
    </tr>
    <tr>
        <td>

            <table width="100%" border="0" align="center" cellspacing="2">
                <!--DWLayoutTable-->
                <tr>
                    <td width="551" height="31">&nbsp;</td>
                    <td width="236" valign="top">
                        <div align="right">Create by :</div>
                    </td>
                    <td width="10">&nbsp;</td>
                    <td width="139">Create Time</td>
                </tr>
                <tr>
                    <td height="31">&nbsp;</td>
                    <td>
                        <div align="right">Update by : </div>
                    </td>
                    <td>&nbsp;</td>
                    <td>Update Time</td>
                </tr>
            </table>
            @Html.Partial("_FixedIncomeHeaderView", Model.PurchaseModel);
            <div>&nbsp;</div>
            @Html.Partial("_FixedIncomePurchaseView", Model.PurchaseModel);
            @using (Html.BeginForm("FixedIncomeGuarantee","FixedIncome",FormMethod.Post, new { id = "mainForm" }))
            {
                <table width="100%" border="0" align="center" cellspacing="2">

                    <tr>
                        <td style="width: 248px">
                            <div align="right">ประเภทธุรกรรม: </div>
                        </td>
                        <td width="10">&nbsp;</td>
                        <td width="260">@Html.TextBoxFor(model => model.TransactionType, new { @readonly = "readonly" })</td>
                        <td align="right" style="width: 184px">&nbsp;</td>
                        <td width="6">&nbsp;</td>
                        <td width="223">&nbsp;</td>
                    </tr>
                    <tr>
                        <td style="width: 248px">
                            <div align="right">ภาระผูกพัน    <span class="error">*</span> : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>
                            @Html.DropDownListFor(model => model.SelectedObligation, Model.ObligationList) @Html.ValidationMessageFor(model => model.SelectedObligation)
                        </td>
                        <td style="width: 184px">
                            <div align="right">ประเภทหลักประกัน <span class="error">*</span> : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>@Html.TextBoxFor(model => model.GuaranteeType)   @Html.ValidationMessageFor(model => model.GuaranteeType)</td>
                    </tr>
                    <tr>
                        <td style="width: 248px">
                            <div align="right">ภาระผูกพันตามมาตรา <span class="error">*</span>   : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>@Html.DropDownListFor(model => model.SelectedObligationNo, Model.ObligationNoList) @Html.ValidationMessageFor(model => model.SelectedObligationNo)                 &nbsp;</td>
                        <td style="width: 184px">
                            <div align="right"></div>
                        </td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td style="width: 248px">
                            <div align="right">Unit <span class="error">*</span> : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>@Html.TextBoxFor(model => model.Unit, new { @class = "inputNumberField" })   @Html.ValidationMessageFor(model => model.Unit)</td>
                        <td style="width: 184px">&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;&nbsp;</td>
                    </tr>

                    <tr>
                            <td>
                                <div align="right">Physical    : </div>
                            </td>
                            <td>&nbsp;</td>
                            <td>
         
                                @Html.DropDownListFor(x => x.SelectedPhysical, Model.PhysicalList)
                            </td>
                            <td>
                                <div align="right">Keep at : </div>
                            </td>
                            <td>&nbsp;</td>
                            <td>
                             
                                @Html.DropDownListFor(x => x.SelectedKeepAt, Model.KeepAtList)
                            </td>
                        </tr>
                    
                    <tr>



                        <td style="width: 248px">
                            <div align="right"> จำนวนฉบับ   : </div>
                        </td>
                        <td>&nbsp;</td>
                       <td>@Html.TextBoxFor(model => model.BookCount, new {@class = "inputNumberField" ,  @Value =ThaireInvestmentWeb.Util.WebUtil.FormatInt( Model.BookCount)  })  </td>
                        <td style="width: 184px">
                            <div align="right"> เลขที่ : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>@Html.TextBoxFor(model => model.BookNo)  </td>
                    </tr>

                    <tr>



                        <td style="width: 248px">
                            <div align="right">Start Date <span class="error">*</span>  : </div>
                        </td>
                        <td>&nbsp;</td>
                       <td>@Html.TextBoxFor(model => model.StartDate, new { @readonly = "readonly", @Value =ThaireInvestmentWeb.Util.WebUtil.FormatDate( Model.StartDate)  })   @Html.ValidationMessageFor(model => model.StartDate)</td>
                        <td style="width: 184px">
                            <div align="right">End Date <span class="error">*</span> : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>@Html.TextBoxFor(model => model.EndDate, new { @readonly = "readonly", @Value =ThaireInvestmentWeb.Util.WebUtil.FormatDate( Model.EndDate)  })   @Html.ValidationMessageFor(model => model.EndDate)</td>
                    </tr>

                    <tr>
                        <td style="width: 248px">&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td style="width: 184px">&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                </table>
                
                <table width="95%" height="85" border="0" align="center">
                    <tr>
                        <td>
                            <div align="center">

                                <input id="BtnSave" type="button" name="BtnSave" value=" Submit " class="button" need-confirm="true" >
                                &nbsp;&nbsp; 
                                <input  type="button" id="BtnCancel" name="BtnCancel" class="btsub" value=" Cancel ">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="center"></div>
                        </td>
                    </tr>
                </table>
     
                @Html.HiddenFor(x => x.UpdateMode);
                @Html.HiddenFor(x => x.HeaderID);
                @Html.HiddenFor(x => x.PurcheseID);
                @Html.HiddenFor(x => x.TransactionID);
            }
            <br>
        </td>
    </tr>
</table>
